import { createRouter, createWebHistory } from 'vue-router'
import Login from "@/views/Login.vue";
import Layout from '@/Layout/index.vue'
import NotFound from '@/views/error/404.vue'

// 创建路由
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      name: 'redirect',
      path: '',
      redirect: '/login',
    },
    {
      name: 'login',
      path: '/login',
      component: Login,
    },
    {
      name: 'index',
      path: '/',
      component: Layout,
      children: [
        {
          path: '/index',
          component: () => import('@/views/index.vue')
        }
      ]
    },
    {
      path: '/error/404',
      name: 'NotFound',
      component: NotFound,
    }
  ]
})
// 导出router
export default router
